# Maintainer: Frederic Wang <fred.wang@free.fr>

_realname=pyasn1
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=0.4.8
pkgrel=1
pkgdesc='ASN.1 types and codecs (mingw-w64)'
url='https://github.com/etingof/pyasn1/'
license=('BSD')
arch=('any')
depends=("${MINGW_PACKAGE_PREFIX}-python")
source=(${_realname}-${pkgver}.tar.gz::"https://github.com/etingof/pyasn1/archive/v${pkgver}.tar.gz")
sha256sums=('1baa319ca6e30ffed0d23198d2100742e9e8b5cae464135d69058d0d6069aafc')

prepare() {
  cd ${srcdir}
  cp -r ${_realname}-${pkgver} build-python-${CARCH}
}

build() {
  cd ${srcdir}/build-python-${CARCH}
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd ${srcdir}/build-python-${CARCH}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --skip-build

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE.rst" "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
